package com.kzc.service.impl;


import com.kzc.dao.StudentDao;
import com.kzc.entity.Student;
import com.kzc.service.StudentService;
import com.kzc.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务层实现
 * Author：柯尊诚
 * Created by anyleKe on 2016/1/29.
 */
@Service
public class StudentServiceImpl implements StudentService{

    @Autowired
    StudentDao studentDao;

    /**
     * 增加
     */
    public int save(Student student) {
        return studentDao.save(student);
    }

    /**
     * 删除
     */
    public int delete(int id) {
        return studentDao.delete(id);
    }

    /**
     * 修改
     */
    public int update(Student student) {
        return studentDao.update(student);
    }

    /**
     * 查询所有
     */
    public List<Student> query() {
        return studentDao.query();
    }

    /**
     * 分页查询
     */
    public List<Student> queryPage(StudentVO vo) {
        int count = studentDao.count(vo);
        vo.getPaging().setRecords(count);
        return studentDao.queryPage(vo);
    }


}
